package nuc.zhangchao.test.config;

import nuc.zhangchao.test.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author Zhang Chao
 * @Date 2020/12/30 3:40
 * @Version 1.0
 */
@Configuration
public class LoginConfigurer implements WebMvcConfigurer{

    //注册拦截器：配置到bean+注册
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/login","/dologin");
        //以为静态资源也需要处理  ”/css/**“

    }
}
